package cn.fraudmetrix.octopus.modules.mock.controller;

import cn.fraudmetrix.octopus.modules.mock.dao.CrawlMockDataDao;
import cn.fraudmetrix.octopus.modules.mock.entity.CrawlMockDataEntity;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.web.bind.annotation.PostMapping;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import javax.annotation.Resource;
import java.util.List;

/**
 * @author libao.zheng
 * @email libao.zheng@tongdun.cn
 * @date 2018/12/21 09:33
 */
@RestController
@RequestMapping("/mock/crawlMockData")
public class CrawlMockDataController {
    @Resource
    private CrawlMockDataDao crawlMockDataDao;
    private final Logger LOGGER = LoggerFactory.getLogger(getClass());

    @PostMapping("/query")
    public List<CrawlMockDataEntity> query(@RequestBody CrawlMockDataEntity crawlMockDataEntity) {
        return crawlMockDataDao.select(crawlMockDataEntity);
    }

    @PostMapping("/add")
    public boolean add(@RequestBody CrawlMockDataEntity crawlMockDataEntity) {
        return crawlMockDataDao.insert(crawlMockDataEntity);
    }

    @PostMapping("/update")
    public boolean update(@RequestBody CrawlMockDataEntity crawlMockDataEntity) {
        return crawlMockDataDao.update(crawlMockDataEntity);
    }

}
